#ifndef MAINPAGE_H
#define MAINPAGE_H

#include <QSerialPort>
#include <QTcpSocket>
#include <QWidget>

namespace Ui {
class MainPage;
}
class GateWayConfig;

class MainPage : public QWidget {
  Q_OBJECT

public:
  explicit MainPage(QWidget *parent = nullptr);
  ~MainPage();

private slots:
  void connectedSlot();
  void disconnectedSlot();
  void serialErrorSlot(QSerialPort::SerialPortError serialPortError);
  void socketErrorSlot(QAbstractSocket::SocketError socketError);
  void on_BT_Net_Connect_clicked();

  void on_BT_SPort_Open_clicked();

  void on_BT_Test_Server_clicked();

  void on_BT_ClearMsg_clicked();

  void on_BT_SaveFile_clicked();

  void on_BT_BrowseFile_clicked();

  void on_BT_Test_Hard_clicked();

  void on_BT_SPort_Refresh_clicked();

private:
  void closeEvent(QCloseEvent *ev);

private:
  Ui::MainPage *ui;

  QScopedPointer<GateWayConfig> gw_config;

  QPair<QString, int> cur_connected;
  int cur_bord;
};

#endif // MAINPAGE_H
